<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>系统首页</title>
    <style>
        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        }

        .container {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        /* 头部样式 */
        .header {
            background-color: #001529;
            padding: 0 20px;
            height: 50px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }

        .welcome {
            display: flex;
            align-items: center;
            gap: 10px;
            color: #fff;
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            object-fit: cover;
        }

        .user-name {
            font-weight: bold;
        }

        .user-info {
            display: flex;
            gap: 10px;
        }

        /* 主体内容样式 */
        .main-content {
            flex: 1;
            padding: 24px;
            background-color: #f0f2f5;
        }

        .module-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 24px;
            margin-top: 24px;
        }

        .module-card {
            background: #fff;
            padding: 24px;
            border-radius: 4px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.1);
            cursor: pointer;
            transition: all 0.3s;
            text-decoration: none;
            color: inherit;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 200px;
        }

        .module-card:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            transform: translateY(-2px);
        }

        .module-icon {
            font-size: 48px;
            margin-bottom: 16px;
            color: #1890ff;
        }

        .module-title {
            font-size: 20px;
            margin-bottom: 8px;
            color: rgba(0,0,0,0.85);
        }

        .module-desc {
            color: rgba(0,0,0,0.45);
            text-align: center;
        }

        .btn {
            padding: 6px 12px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .btn-primary {
            background-color: #1890ff;
            color: white;
        }

        .btn-danger {
            background-color: #ff4d4f;
            color: white;
        }
    </style>
</head>
<body>
    <div class="container">
        <header class="header">
            <div class="welcome">
                <img id="userAvatar" class="user-avatar" src="" alt="头像">
                <span>欢迎回来，<span id="userName" class="user-name"></span></span>
            </div>
            <div class="user-info">
                <button class="btn btn-primary" onclick="editProfile()">个人信息</button>
                <button class="btn btn-danger" onclick="logout()">退出登录</button>
            </div>
        </header>

        <main class="main-content">
            <h2>系统模块</h2>
            <div class="module-container">
                <!-- 订单管理模块 -->
                <a href="/order/views/main/index.html" class="module-card">
                    <div class="module-icon">📦</div>
                    <div class="module-title">订单管理</div>
                    <div class="module-desc">管理销售订单和售后订单</div>
                </a>

                <!-- 其他模块卡片 -->
                <!-- 可以根据需要添加更多模块 -->
            </div>
        </main>
    </div>

    <script>
        // 检查登录状态并加载用户信息
        function checkLogin() {
            const user = JSON.parse(localStorage.getItem('user'));
            if (!user) {
                window.location.href = '/login.html';
                return;
            }

            document.getElementById('userName').textContent = user.nickname || user.username;
            document.getElementById('userAvatar').src = user.avatar || '/images/default-avatar.png';
        }

        // 编辑个人信息
        function editProfile() {
            window.location.href = '/profile.html';
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('user');
            localStorage.removeItem('token');
            window.location.href = '/login.html';
        }

        // 页面加载完成后执行
        document.addEventListener('DOMContentLoaded', function() {
            checkLogin();
        });
    </script>
</body>
</html> 